﻿/// <reference path="../module/rsseasy.v2.js" />
/// <reference path="../jquery.min.js" />
/// <reference path="../module/rssapi.v2.js" />

$(function () {
    var housepage = RssPage.get("#housepage"), item = housepage.find("article>ul");

    var ajax = RssApi.Table.List("house");

    housepage.load(function () {
        ajax.getJson(function (data) {
            item.mapview(data, {
                "ico": function (val) {
                    return RssUpFile.ThumbUrl(val);
                }
            }, 2).click(function () {
                location.href = "#housedetailpage";
            });
        });
    });

    //民俗详情页
    var housedetailpage = $("#housedetailpage");
    housedetailpage.load(function () {
        var t = $(this);
        RssApi.Table.Detail("house").condition(new RssDict(t.data("mapquery")).getDict()).getJson(function (data) {
            t.mapjson(data);
        });
    });
    housedetailpage.find("footer a").click(function () {
        var t = $(this), rssid = t.attr("rssid");

    });

    //民俗订单页
    var houseorderpage = $("#houseorderpage");

    houseorderpage.load(function () {
        RssApi.Table.List("discount_coupon_user_view").condition(new RssDict().keymyid().keyvalue("state", 0).getDict()).getJson(function (data) {
            houseorderpage.find("[usercoupon]").mapview(data);
        });
    });
});